euler <- read.table("euler.res")
integral <- read.table("integral.res")

eulerapprox <- as.data.frame(t(euler))
integralapprox <- as.data.frame(t(integral))

eapp <- eulerapprox[2:length(eulerapprox[,]),]
iapp <- integralapprox[2:length(eulerapprox[,]),]
apmax <- max(max(eapp), max(iapp))
apmin <- min(min(eapp), min(iapp))

plot(seq(501, 10000, 500),eapp, ylim=c(apmin, apmax), type="n", ylab="Approximated Stock Price", xlab = "Number of Stock Price Realizations")
lines(seq(501, 10000, 500),eapp,lty=3)
lines(seq(501, 10000, 500),iapp, lty=4)
abline(b=0, a=11.5443)
par(new = T)

plot(seq(501, 10000, 500), abs(11.5443 - eapp), type="l",col="red",axes=F,ylab="",xlab="",lty=3)
lines(seq(501, 10000, 500), abs(11.5443 - iapp), col="red", lty=4)
axis(4)
legend(6000,0.4,c("Euler approximation", "Integral approximation", "Analytical result", "Absolute difference between Euler en analytical", "Absolute difference between Integral and analytical"),lty=c(3,4,1,3,4), col=c("black", "black", "black", "red", "red"))
par(new = F)